package com.woniuxy.rateassembly.dao;

import com.woniuxy.rateassembly.model.Comment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zz
 * @since 2021-05-27
 */
public interface CommentMapper extends BaseMapper<Comment> {

    //根据用户id查看评论
    @Select("SELECT * FROM hotel_comment WHERE user_id=#{userId}")
    public List<Comment> findCommentByUserId(Integer UserId);

    //根据酒店id查看评论
    @Select("SELECT * FROM hotel_comment WHERE hotel_id=#{hotelId}")
    public List<Comment> findCommentByHotelId(Integer HotelId);

    //根据评论id删除评论
    @Delete("DELETE FROM hotel_comment WHERE comment_id=#{commentId}")
    public void delectCommentById(Integer commentId);
}
